package rooms.southPod;

import actions.Direction;
import rooms.Room;
import exceptions.MudExceptions;
import mobs.NPC;
import items.Item;

import java.util.ArrayList;
import java.util.List;

public class SupportMarketingRoom implements Room {
    private static Room me;

    private List<NPC> mobs = new ArrayList<NPC>();
    private List<Item> items = new ArrayList<Item>();

    public static synchronized Room getInstance() {
        if (me == null) {
            me = new SupportMarketingRoom();
        }
        return me;
    }
    
    public String getTitle() {
        return "Support's Marketing Room";
    }

    public String getDescription() {
        return "You are in a claustrophobic room that has only one desk and still feels cluttered.";
    }

    public String getLongDescription() {
        return "This is where support's most enginuitive people gather.  You can feel the complexity of your thoughts " +
                "increasing.  It seems like there are no simple solutions to anything any more.  There is a motorized " +
                "couch in the corner.  Does that thing work?";
    }

    @Override
    public Room getRoomMove(Direction direction) {
        Room room;
        if (direction == Direction.EAST) {
            room = EastHallway1.getInstance();
        } else if (direction == Direction.DOWN) {
            throw MudExceptions.invalidMoveDown();
        } else if (direction == Direction.UP) {
            throw MudExceptions.invalidMoveUp();
        } else {
            throw MudExceptions.invalidMove();
        }
        return room;
    }

    public List<NPC> getActiveNPCs() {
        return mobs;
    }

    public String showMobs() {
        StringBuffer rtn = new StringBuffer();
        for (NPC npc : getActiveNPCs()) {
            rtn.append(npc.getName());
            rtn.append("\n");
        }
        return rtn.toString();
    }

    public List<Item> getRoomItems() {
        return items;
    }

     public String showItems() {
        StringBuffer rtn = new StringBuffer();
        for (Item item : getRoomItems()) {
            rtn.append(item.getTitle());
            rtn.append("\n");
        }
        return rtn.toString();
    }
}